package com.bachongLightNovel.system.controller;

import com.bachongLightNovel.result.Result;
import com.bachongLightNovel.system.service.FileUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/system")
@Slf4j
public class FileUploadController {

    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/upload")
    public Result upload(@RequestParam MultipartFile file){
        log.info("文件上传");
        String url=fileUploadService.upload(file);
        return Result.success(url);
    }
}
